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-2025 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//var_dump($data);
184// $data = array(array('Lib',val1,val2,val3),...)
185
186
187$fileurlnb = '';
188if (!$user->hasRight('societe', 'client', 'voir')) {
189 $filenamenb = $dir.'/ordersnbinyear-'.$user->id.'-'.$year.'.png';
190 if ($mode == 'customer') {
191 $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersnbinyear-'.$user->id.'-'.$year.'.png';
192 }
193 if ($mode == 'supplier') {
194 $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersnbinyear-'.$user->id.'-'.$year.'.png';
195 }
196} else {
197 $filenamenb = $dir.'/ordersnbinyear-'.$year.'.png';
198 if ($mode == 'customer') {
199 $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersnbinyear-'.$year.'.png';
200 }
201 if ($mode == 'supplier') {
202 $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersnbinyear-'.$year.'.png';
203 }
204}
205
206$px1 = new DolGraph();
207$mesg = $px1->isGraphKo();
208if (!$mesg) {
209 $px1->SetData($data);
210 $i = $startyear;
211 $legend = array();
212 while ($i <= $endyear) {
213 $legend[] = $i;
214 $i++;
215 }
216 $px1->SetLegend($legend);
217 $px1->SetMaxValue($px1->GetCeilMaxValue());
218 $px1->SetMinValue(min(0, $px1->GetFloorMinValue()));
219 $px1->SetWidth($WIDTH);
220 $px1->SetHeight($HEIGHT);
221 $px1->SetYLabel($langs->trans("NbOfOrder"));
222 $px1->SetShading(3);
223 $px1->SetHorizTickIncrement(1);
224 $px1->mode = 'depth';
225 $px1->SetTitle($langs->trans("NumberOfOrdersByMonth"));
226
227 $px1->draw($filenamenb, $fileurlnb);
228}
229
230// Build graphic amount of object
231$data = $stats->getAmountByMonthWithPrevYear($endyear, $startyear);
232//var_dump($data);
233// $data = array(array('Lib',val1,val2,val3),...)
234
235$fileurlamount = '';
236if (!$user->hasRight('societe', 'client', 'voir')) {
237 $filenameamount = $dir.'/ordersamountinyear-'.$user->id.'-'.$year.'.png';
238 if ($mode == 'customer') {
239 $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersamountinyear-'.$user->id.'-'.$year.'.png';
240 }
241 if ($mode == 'supplier') {
242 $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersamountinyear-'.$user->id.'-'.$year.'.png';
243 }
244} else {
245 $filenameamount = $dir.'/ordersamountinyear-'.$year.'.png';
246 if ($mode == 'customer') {
247 $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersamountinyear-'.$year.'.png';
248 }
249 if ($mode == 'supplier') {
250 $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersamountinyear-'.$year.'.png';
251 }
252}
253
254$px2 = new DolGraph();
255$mesg = $px2->isGraphKo();
256if (!$mesg) {
257 $px2->SetData($data);
258 $i = $startyear;
259 $legend = array();
260 while ($i <= $endyear) {
261 $legend[] = $i;
262 $i++;
263 }
264 $px2->SetLegend($legend);
265 $px2->SetMaxValue($px2->GetCeilMaxValue());
266 $px2->SetMinValue(min(0, $px2->GetFloorMinValue()));
267 $px2->SetWidth($WIDTH);
268 $px2->SetHeight($HEIGHT);
269 $px2->SetYLabel($langs->trans("AmountOfOrders"));
270 $px2->SetShading(3);
271 $px2->SetHorizTickIncrement(1);
272 $px2->mode = 'depth';
273 $px2->SetTitle($langs->trans("AmountOfOrdersByMonthHT"));
274
275 $px2->draw($filenameamount, $fileurlamount);
276}
277
278
279$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear);
280
281
282$fileurl_avg = '';
283if (!$user->hasRight('societe', 'client', 'voir')) {
284 $filename_avg = $dir.'/ordersaverage-'.$user->id.'-'.$year.'.png';
285 if ($mode == 'customer') {
286 $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$user->id.'-'.$year.'.png';
287 }
288 if ($mode == 'supplier') {
289 $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersaverage-'.$user->id.'-'.$year.'.png';
290 }
291} else {
292 $filename_avg = $dir.'/ordersaverage-'.$year.'.png';
293 if ($mode == 'customer') {
294 $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$year.'.png';
295 }
296 if ($mode == 'supplier') {
297 $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersaverage-'.$year.'.png';
298 }
299}
300
301$px3 = new DolGraph();
302$mesg = $px3->isGraphKo();
303if (!$mesg) {
304 $px3->SetData($data);
305 $i = $startyear;
306 $legend = array();
307 while ($i <= $endyear) {
308 $legend[] = $i;
309 $i++;
310 }
311 $px3->SetLegend($legend);
312 $px3->SetYLabel($langs->trans("AmountAverage"));
313 $px3->SetMaxValue($px3->GetCeilMaxValue());
314 $px3->SetMinValue((int) $px3->GetFloorMinValue());
315 $px3->SetWidth($WIDTH);
316 $px3->SetHeight($HEIGHT);
317 $px3->SetShading(3);
318 $px3->SetHorizTickIncrement(1);
319 $px3->mode = 'depth';
320 $px3->SetTitle($langs->trans("AmountAverage"));
321
322 $px3->draw($filename_avg, $fileurl_avg);
323}
324
325
326
327// Show array
328$data = $stats->getAllByYear();
329$arrayyears = array();
330foreach ($data as $val) {
331 if (!empty($val['year'])) {
332 $arrayyears[$val['year']] = $val['year'];
333 }
334}
335if (!count($arrayyears)) {
336 $arrayyears[$nowyear] = $nowyear;
337}
338
339$h = 0;
340$head = array();
341$head[$h][0] = DOL_URL_ROOT.'/commande/stats/index.php?mode='.$mode;
342$head[$h][1] = $langs->trans("ByMonthYear");
343$head[$h][2] = 'byyear';
344$h++;
345
346$type = 'order_stats';
347
348if ($mode == 'supplier') {
349 $type = 'supplier_order_stats';
350}
351
352complete_head_from_modules($conf, $langs, null, $head, $h, $type);
353
354print dol_get_fiche_head($head, 'byyear', '', -1);
355
356
357print '<div class="fichecenter"><div class="fichethirdleft">';
358
359
360// Show filter box
361print '<form name="stats" method="POST" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
362print '<input type="hidden" name="token" value="'.newToken().'">';
363print '<input type="hidden" name="mode" value="'.$mode.'">';
364
365print '<table class="noborder centpercent">';
366print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
367// Company
368print '<tr><td class="left">'.$langs->trans("ThirdParty").'</td><td class="left">';
369$filter = '';
370if ($mode == 'customer') {
371 $filter = '(s.client:IN:1,2,3)';
372}
373if ($mode == 'supplier') {
374 $filter = '(s.fournisseur:=:1)';
375}
376print img_picto('', 'company', 'class="pictofixedwidth"');
377print $form->select_company($socid, 'socid', $filter, 1, 0, 0, array(), 0, 'widthcentpercentminusx maxwidth300');
378print '</td></tr>';
379// ThirdParty Type
380print '<tr><td>'.$langs->trans("ThirdPartyType").'</td><td>';
381$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.
382print $form->selectarray("typent_id", $formcompany->typent_array(0), $typent_id, 1, 0, 0, '', 0, 0, 0, $sortparam_typent, '', 1);
383if ($user->admin) {
384 print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
385}
386print '</td></tr>';
387// Category societe
388$cat_type = 0;
389$cat_label = '';
390if ($mode == 'customer') {
391 $cat_type = Categorie::TYPE_CUSTOMER;
392 $cat_label = $langs->trans("Category").' '.lcfirst($langs->trans("Customer"));
393}
394if ($mode == 'supplier') {
395 $cat_type = Categorie::TYPE_SUPPLIER;
396 $cat_label = $langs->trans("Category").' '.lcfirst($langs->trans("Supplier"));
397}
398print '<tr><td>'.$cat_label.'</td><td>';
399print img_picto('', 'category', 'class="pictofixedwidth"');
400print $formother->select_categories($cat_type, $categ_id, 'categ_id', 0, 1, 'widthcentpercentminusx maxwidth300');
401print '</td></tr>';
402// Category commande
403if (isModEnabled('category')) {
404 $cat_type = '';
405 $cat_label = '';
406 if ($mode == 'customer') {
407 $cat_type = Categorie::TYPE_ORDER;
408 $cat_label = $langs->trans("Category").' '.lcfirst($langs->trans("CustomersOrders"));
409 }
410 if ($mode == 'supplier') {
411 $cat_type = Categorie::TYPE_SUPPLIER_ORDER;
412 $cat_label = $langs->trans("Category").' '.lcfirst($langs->trans("SuppliersOrders"));
413 }
414 print '<tr><td>'.$cat_label.'</td><td>';
415 $cate_arbo = $form->select_all_categories($cat_type, '', 'parent', 0, 0, 1);
416 print img_picto('', 'category', 'class="pictofixedwidth"');
417 print $form->multiselectarray('select_categ_comande_id', $cate_arbo, GETPOST('select_categ_comande_id', 'array'), 0, 0, 'widthcentpercentminusx maxwidth300');
418 //print $formother->select_categories($cat_type, $categ_id, 'categ_id', true);
419 print '</td></tr>';
420}
421// User
422print '<tr><td>'.$langs->trans("CreatedBy").'</td><td>';
423print img_picto('', 'user', 'class="pictofixedwidth"');
424// Pass -1 (not 0) when no user is selected so the combo keeps its empty entry instead of defaulting to the
425// current user. The statistics query below is not filtered on the current user by default, so preselecting
426// them here wrongly suggests the displayed figures are limited to that user while they are actually global.
427print $form->select_dolusers(($userid > 0 ? $userid : -1), 'userid', 1, null, 0, '', '', '0', 0, 0, '', 0, '', 'widthcentpercentminusx maxwidth300');
428// Status
429print '<tr><td>'.$langs->trans("Status").'</td><td>';
430if ($mode == 'customer') {
431 $liststatus = array(
432 Commande::STATUS_DRAFT => $langs->trans("StatusOrderDraft"),
433 Commande::STATUS_VALIDATED => $langs->trans("StatusOrderValidated"),
434 Commande::STATUS_SHIPMENTONPROCESS => $langs->trans("StatusOrderSent"),
435 Commande::STATUS_CLOSED => $langs->trans("StatusOrderDelivered"),
436 Commande::STATUS_CANCELED => $langs->trans("StatusOrderCanceled")
437 );
438 print $form->selectarray('object_status', $liststatus, GETPOST('object_status', 'intcomma'), -4);
439}
440if ($mode == 'supplier') {
441 $formorder->selectSupplierOrderStatus((strstr($object_status, ',') ? -1 : $object_status), 0, 'object_status');
442}
443print '</td></tr>';
444// Year
445print '<tr><td class="left">'.$langs->trans("Year").'</td><td class="left">';
446if (!in_array($year, $arrayyears)) {
447 $arrayyears[$year] = $year;
448}
449if (!in_array($nowyear, $arrayyears)) {
450 $arrayyears[$nowyear] = $nowyear;
451}
452arsort($arrayyears);
453print img_picto('', 'calendar', 'class="pictofixedwidth"');
454print $form->selectarray('year', $arrayyears, $year, 0, 0, 0, '', 0, 0, 0, '', 'width75');
455print '</td></tr>';
456print '<tr><td align="center" colspan="2"><input type="submit" class="button small" name="submit" value="'.$langs->trans("Refresh").'"></td></tr>';
457print '</table>';
458print '</form>';
459print '<br><br>';
460
461
462print '<div class="div-table-responsive-no-min">';
463print '<table class="noborder centpercent">';
464print '<tr class="liste_titre" height="24">';
465print '<td class="center">'.$langs->trans("Year").'</td>';
466print '<td class="right">'.$langs->trans("NbOfOrders").'</td>';
467print '<td class="right">%</td>';
468print '<td class="right">'.$langs->trans("AmountTotal").'</td>';
469print '<td class="right">%</td>';
470print '<td class="right">'.$langs->trans("AmountAverage").'</td>';
471print '<td class="right">%</td>';
472print '</tr>';
473
474$oldyear = 0;
475foreach ($data as $val) {
476 $year = $val['year'];
477 while (!empty($year) && $oldyear > (int) $year + 1) { // If we have empty year
478 $oldyear--;
479
480 print '<tr class="oddeven" height="24">';
481 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>';
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 '<td class="right">0</td>';
487 print '<td class="right"></td>';
488 print '</tr>';
489 }
490
491
492 print '<tr class="oddeven" height="24">';
493 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>';
494 print '<td class="right">'.$val['nb'].'</td>';
495 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>';
496 print '<td class="right">'.price(price2num($val['total'], 'MT'), 1).'</td>';
497 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>';
498 print '<td class="right">'.price(price2num($val['avg'], 'MT'), 1).'</td>';
499 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>';
500 print '</tr>';
501 $oldyear = $year;
502}
503
504print '</table>';
505print '</div>';
506
507
508print '</div><div class="fichetwothirdright">';
509
510
511// Show graphs
512print '<table class="border centpercent"><tr class="pair nohover"><td align="center">';
513if ($mesg) {
514 print $mesg;
515} else {
516 print $px1->show();
517 print "<br>\n";
518 print $px2->show();
519 print "<br>\n";
520 print $px3->show();
521}
522print '</td></tr></table>';
523
524
525print '</div></div>';
526print '<div class="clearboth"></div>';
527
528print dol_get_fiche_end();
529
530// End of page
531llxFooter();
532$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.
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.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
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.
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.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
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)
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.