dolibarr 24.0.0-beta
index.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (c) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
5 * Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
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.'/core/class/dolgraph.class.php';
41require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
42require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
43require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
44require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facturestats.class.php';
45if (isModEnabled('category')) {
46 require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
47}
48
51
52// Load translation files required by the page
53$langs->loadLangs(array('bills', 'companies', 'other'));
54
55$mode = GETPOST("mode") ? GETPOST("mode") : 'customer';
56
57$hookmanager->initHooks(array('invoicestats', 'globalcard'));
58
59if ($mode == 'customer' && !$user->hasRight('facture', 'lire')) {
61}
62if ($mode == 'supplier' && !$user->hasRight('fournisseur', 'facture', 'lire')) {
64}
65
66$object_status = GETPOST('object_status', 'intcomma');
67$typent_id = GETPOSTINT('typent_id');
68$categ_id = GETPOSTINT('categ_id');
69
70$userid = GETPOSTINT('userid');
71$socid = GETPOSTINT('socid');
72$select_categ_categ_id = GETPOST('select_categ_categ_id', 'array:int');
73$select_categ_invoice_id=GETPOST('select_categ_invoice_id', 'array:int');
74// Security check
75if ($user->socid > 0) {
76 $action = '';
77 $socid = $user->socid;
78}
79
80$parameters = array();
81$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
82if ($reshook < 0) {
83 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
84}
85
86$nowyear = dol_print_date(dol_now('gmt'), "%Y", 'gmt');
87$year = GETPOST('year') > 0 ? GETPOSTINT('year') : $nowyear;
88$startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS'))));
89$endyear = $year;
90
91
92/*
93 * View
94 */
95if (isModEnabled('category')) {
96 $langs->load('categories');
97}
98$form = new Form($db);
99$formcompany = new FormCompany($db);
100$formother = new FormOther($db);
101
102
103$picto = 'bill';
104$title = $langs->trans("BillsCustomers");
105$dir = $conf->invoice->dir_temp;
106
107if ($mode == 'supplier') {
108 $picto = 'supplier_invoice';
109 $title = $langs->trans("BillsStatisticsSuppliers");
110 $dir = $conf->fournisseur->facture->dir_temp;
111}
112
113llxHeader('', $title);
114
115$page = 0;
116$param = '';
117$sortfield = '';
118$sortorder = '';
119$massactionbutton = '';
120$num = 0;
121$nbtotalofrecords = $langs->trans("Statistics");
122$limit = 0;
123
124$newcardbutton = '';
125if ($mode == 'supplier') {
126 $urlnew = DOL_URL_ROOT.'/fourn/facture/card.php?action=create';
127 if (!empty($socid)) {
128 $urlnew .= '&socid='.$socid;
129 }
130 $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/fourn/facture/list.php?mode=common', '', 1, array('morecss' => 'reposition'));
131 $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', DOL_URL_ROOT.'/fourn/facture/list.php?mode=kanban', '', 1, array('morecss' => 'reposition'));
132 $newcardbutton .= dolGetButtonTitle($langs->trans('Statistics'), '', 'fa fa-chart-bar imgforviewmode', DOL_URL_ROOT.'/compta/facture/stats/index.php?mode=supplier', '', 2, array('morecss' => 'reposition'));
133 $newcardbutton .= dolGetButtonTitleSeparator();
134 $newcardbutton .= dolGetButtonTitle($langs->trans('NewBill'), '', 'fa fa-plus-circle', $urlnew, '', (int) ($user->hasRight('fournisseur', 'facture', 'creer') || $user->hasRight('supplier_invoice', 'creer')));
135} else {
136 $urlnew = DOL_URL_ROOT.'/compta/facture/card.php?action=create';
137 if (!empty($socid)) {
138 $urlnew .= '&socid='.$socid;
139 }
140 $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/compta/facture/list.php?mode=common', '', 1, array('morecss' => 'reposition'));
141 $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', DOL_URL_ROOT.'/compta/facture/list.php?mode=kanban', '', 1, array('morecss' => 'reposition'));
142 $newcardbutton .= dolGetButtonTitle($langs->trans('Statistics'), '', 'fa fa-chart-bar imgforviewmode', DOL_URL_ROOT.'/compta/facture/stats/index.php', '', 2, array('morecss' => 'reposition'));
143 $newcardbutton .= dolGetButtonTitleSeparator();
144 $newcardbutton .= dolGetButtonTitle($langs->trans('NewBill'), '', 'fa fa-plus-circle', $urlnew, '', $user->hasRight('facture', 'creer'));
145}
146
147print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
148
149dol_mkdir($dir);
150
151$stats = new FactureStats($db, $socid, $mode, ($userid > 0 ? $userid : 0), ($typent_id > 0 ? $typent_id : 0), ($categ_id > 0 ? $categ_id : 0));
152if ($mode == 'customer') {
153 if ($object_status != '' && $object_status >= 0) {
154 $stats->where .= ' AND f.fk_statut IN ('.$db->sanitize($object_status).')';
155 }
156 if (is_array($select_categ_categ_id) && !empty($select_categ_categ_id)) {
157 $stats->from .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_societe as cat ON (f.fk_soc = cat.fk_soc)';
158 $stats->where .= ' AND cat.fk_categorie IN ('.$db->sanitize(implode(',', $select_categ_categ_id)).')';
159 }
160 if (is_array($select_categ_invoice_id) && !empty($select_categ_invoice_id)) {
161 $stats->from .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_invoice as cat ON (f.rowid = cat.fk_invoice)';
162 $stats->where .= ' AND cat.fk_categorie IN ('.$db->sanitize(implode(',', $select_categ_invoice_id)).')';
163 }
164}
165if ($mode == 'supplier') {
166 if ($object_status != '' && $object_status >= 0) {
167 $stats->where .= ' AND f.fk_statut IN ('.$db->sanitize($object_status).')';
168 }
169 if (is_array($select_categ_categ_id) && !empty($select_categ_categ_id)) {
170 $stats->from .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_fournisseur as cat ON (f.fk_soc = cat.fk_soc)';
171 $stats->where .= ' AND cat.fk_categorie IN ('.$db->sanitize(implode(',', $select_categ_categ_id)).')';
172 }
173 if (is_array($select_categ_invoice_id) && !empty($select_categ_invoice_id)) {
174 $stats->from .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_supplier_invoice as cat ON (f.rowid = cat.fk_supplier_invoice)';
175 $stats->where .= ' AND cat.fk_categorie IN ('.$db->sanitize(implode(',', $select_categ_invoice_id)).')';
176 }
177}
178
179// Build graphic number of object
180// $data = array(array('Lib',val1,val2,val3),...)
181$data = $stats->getNbByMonthWithPrevYear($endyear, $startyear);
182//var_dump($data);
183
184$filenamenb = $dir."/invoicesnbinyear-".$year.".png";
185$fileurlnb = '';
186if ($mode == 'customer') {
187 $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesnbinyear-'.$year.'.png';
188}
189if ($mode == 'supplier') {
190 $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicesnbinyear-'.$year.'.png';
191}
192
193$px1 = new DolGraph();
194$mesg = $px1->isGraphKo();
195if (!$mesg) {
196 $px1->SetData($data);
197 $i = $startyear;
198 $legend = array();
199 while ($i <= $endyear) {
200 $legend[] = $i;
201 $i++;
202 }
203 $px1->SetLegend($legend);
204 $px1->SetMaxValue($px1->GetCeilMaxValue());
205 $px1->SetWidth($WIDTH);
206 $px1->SetHeight($HEIGHT);
207 $px1->SetYLabel($langs->trans("NumberOfBills"));
208 $px1->SetShading(3);
209 $px1->SetHorizTickIncrement(1);
210 $px1->mode = 'depth';
211 $px1->SetTitle($langs->trans("NumberOfBillsByMonth"));
212
213 $px1->draw($filenamenb, $fileurlnb);
214}
215
216// Build graphic amount of object
217$data = $stats->getAmountByMonthWithPrevYear($endyear, $startyear);
218//var_dump($data);
219// $data = array(array('Lib',val1,val2,val3),...)
220
221$filenameamount = $dir."/invoicesamountinyear-".$year.".png";
222$fileurlamount = '';
223if ($mode == 'customer') {
224 $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&amp;file=invoicesamountinyear-'.$year.'.png';
225}
226if ($mode == 'supplier') {
227 $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&amp;file=invoicesamountinyear-'.$year.'.png';
228}
229
230$px2 = new DolGraph();
231$mesg = $px2->isGraphKo();
232if (!$mesg) {
233 $px2->SetData($data);
234 $i = $startyear;
235 $legend = array();
236 while ($i <= $endyear) {
237 $legend[] = $i;
238 $i++;
239 }
240 $px2->SetLegend($legend);
241 $px2->SetMaxValue($px2->GetCeilMaxValue());
242 $px2->SetMinValue(min(0, $px2->GetFloorMinValue()));
243 $px2->SetWidth($WIDTH);
244 $px2->SetHeight($HEIGHT);
245 $px2->SetYLabel($langs->trans("AmountOfBills"));
246 $px2->SetShading(3);
247 $px2->SetHorizTickIncrement(1);
248 $px2->mode = 'depth';
249 $px2->SetTitle($langs->trans("AmountOfBillsByMonthHT"));
250
251 $px2->draw($filenameamount, $fileurlamount);
252}
253
254
255$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear);
256
257$fileurl_avg = '';
258if (!$user->hasRight('societe', 'client', 'voir')) {
259 $filename_avg = $dir.'/ordersaverage-'.$user->id.'-'.$year.'.png';
260 if ($mode == 'customer') {
261 $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$user->id.'-'.$year.'.png';
262 }
263 if ($mode == 'supplier') {
264 $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersaverage-'.$user->id.'-'.$year.'.png';
265 }
266} else {
267 $filename_avg = $dir.'/ordersaverage-'.$year.'.png';
268 if ($mode == 'customer') {
269 $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$year.'.png';
270 }
271 if ($mode == 'supplier') {
272 $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersaverage-'.$year.'.png';
273 }
274}
275
276$px3 = new DolGraph();
277$mesg = $px3->isGraphKo();
278if (!$mesg) {
279 $px3->SetData($data);
280 $i = $startyear;
281 $legend = array();
282 while ($i <= $endyear) {
283 $legend[] = $i;
284 $i++;
285 }
286 $px3->SetLegend($legend);
287 $px3->SetYLabel($langs->trans("AmountAverage"));
288 $px3->SetMaxValue($px3->GetCeilMaxValue());
289 $px3->SetMinValue((int) $px3->GetFloorMinValue());
290 $px3->SetWidth($WIDTH);
291 $px3->SetHeight($HEIGHT);
292 $px3->SetShading(3);
293 $px3->SetHorizTickIncrement(1);
294 $px3->mode = 'depth';
295 $px3->SetTitle($langs->trans("AmountAverage"));
296
297 $px3->draw($filename_avg, $fileurl_avg);
298}
299
300
301// Show array
302$data = $stats->getAllByYear();
303$arrayyears = array();
304foreach ($data as $val) {
305 $arrayyears[$val['year']] = $val['year'];
306}
307if (!count($arrayyears)) {
308 $arrayyears[$nowyear] = $nowyear;
309}
310
311
312$h = 0;
313$head = array();
314$head[$h][0] = DOL_URL_ROOT.'/compta/facture/stats/index.php?mode='.urlencode($mode);
315$head[$h][1] = $langs->trans("ByMonthYear");
316$head[$h][2] = 'byyear';
317$h++;
318
319$type = 'invoice_stats';
320if ($mode == 'supplier') {
321 $type = 'supplier_invoice_stats';
322}
323
324complete_head_from_modules($conf, $langs, null, $head, $h, $type);
325
326print dol_get_fiche_head($head, 'byyear', '', -1);
327
328print '<div class="fichecenter"><div class="fichethirdleft">';
329
330
331// Show filter box
332print '<form name="stats" method="POST" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
333print '<input type="hidden" name="token" value="'.newToken().'">';
334print '<input type="hidden" name="mode" value="'.$mode.'">';
335
336print '<table class="noborder centpercent">';
337print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
338// Company
339print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
340$filter = '';
341if ($mode == 'customer') {
342 $filter = '(s.client:IN:1,2,3)';
343}
344if ($mode == 'supplier') {
345 $filter = '(s.fournisseur:=:1)';
346}
347print img_picto('', 'company', 'class="pictofixedwidth"');
348print $form->select_company($socid, 'socid', $filter, 1, 0, 0, array(), 0, 'widthcentpercentminusx maxwidth300');
349print '</td></tr>';
350
351// ThirdParty Type
352print '<tr><td>'.$langs->trans("ThirdPartyType").'</td><td>';
353$sortparam_typent = getDolGlobalString('SOCIETE_SORT_ON_TYPEENT', 'ASC'); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label.
354print $form->selectarray("typent_id", $formcompany->typent_array(0), $typent_id, 1, 0, 0, '', 0, 0, 0, $sortparam_typent, '', 1);
355if ($user->admin) {
356 print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
357}
358print '</td></tr>';
359
360// Category
361if (isModEnabled('category')) {
362 $cat_type = '';
363 $cat_label = '';
364 if ($mode == 'customer') {
365 $cat_type = Categorie::TYPE_CUSTOMER;
366 $cat_label = $langs->trans("Category").' '.lcfirst($langs->trans("Customer"));
367 }
368 if ($mode == 'supplier') {
369 $cat_type = Categorie::TYPE_SUPPLIER;
370 $cat_label = $langs->trans("Category").' '.lcfirst($langs->trans("Supplier"));
371 }
372 print '<tr><td>'.$cat_label.'</td><td>';
373 $cate_arbo = $form->select_all_categories($cat_type, '', 'parent', 0, 0, 1);
374 print img_picto('', 'category', 'class="pictofixedwidth"');
375 print $form->multiselectarray('select_categ_categ_id', $cate_arbo, GETPOST('select_categ_categ_id', 'array'), 0, 0, 'widthcentpercentminusx maxwidth300');
376 //print $formother->select_categories($cat_type, $categ_id, 'categ_id', true);
377 print '</td></tr>';
378}
379
380
381// Category facture
382if (isModEnabled('category')) {
383 $cat_type = '';
384 $cat_label = '';
385 if ($mode == 'customer') {
386 $cat_type = Categorie::TYPE_INVOICE;
387 $cat_label = $langs->trans("Category").' '.lcfirst($langs->trans("BillsCustomers"));
388 }
389 if ($mode == 'supplier') {
390 $cat_type = Categorie::TYPE_SUPPLIER_INVOICE;
391 $cat_label = $langs->trans("Category").' '.lcfirst($langs->trans("BillsSuppliers"));
392 }
393 print '<tr><td>'.$cat_label.'</td><td>';
394 $cate_arbo = $form->select_all_categories($cat_type, '', 'parent', 0, 0, 1);
395 print img_picto('', 'category', 'class="pictofixedwidth"');
396 print $form->multiselectarray('select_categ_invoice_id', $cate_arbo, GETPOST('select_categ_invoice_id', 'array'), 0, 0, 'widthcentpercentminusx maxwidth300');
397 //print $formother->select_categories($cat_type, $categ_id, 'categ_id', true);
398 print '</td></tr>';
399}
400
401
402// User
403print '<tr><td>'.$langs->trans("CreatedBy").'</td><td>';
404print img_picto('', 'user', 'class="pictofixedwidth"');
405print $form->select_dolusers($userid ? $userid : -1, 'userid', 1, null, 0, '', '', '0', 0, 0, '', 0, '', 'widthcentpercentminusx maxwidth300');
406print '</td></tr>';
407// Status
408print '<tr><td>'.$langs->trans("Status").'</td><td>';
409if ($mode == 'customer') {
410 $liststatus = array('0' => $langs->trans("BillStatusDraft"), '1' => $langs->trans("BillStatusNotPaid"), '2' => $langs->trans("BillStatusPaid"), '1,2' => $langs->trans("BillStatusNotPaid").' / '.$langs->trans("BillStatusPaid"), '3' => $langs->trans("BillStatusCanceled"));
411 print $form->selectarray('object_status', $liststatus, $object_status, 1);
412}
413if ($mode == 'supplier') {
414 $liststatus = array('0' => $langs->trans("BillStatusDraft"), '1' => $langs->trans("BillStatusNotPaid"), '2' => $langs->trans("BillStatusPaid"));
415 print $form->selectarray('object_status', $liststatus, $object_status, 1);
416}
417print '</td></tr>';
418// Year
419print '<tr><td>'.$langs->trans("Year").'</td><td>';
420if (!in_array($year, $arrayyears)) {
421 $arrayyears[$year] = $year;
422}
423if (!in_array($nowyear, $arrayyears)) {
424 $arrayyears[$nowyear] = $nowyear;
425}
426arsort($arrayyears);
427print img_picto('', 'calendar', 'class="pictofixedwidth"');
428print $form->selectarray('year', $arrayyears, $year, 0, 0, 0, '', 0, 0, 0, '', 'width75');
429print '</td></tr>';
430print '<tr><td class="center" colspan="2"><input type="submit" name="submit" class="button small" value="'.$langs->trans("Refresh").'"></td></tr>';
431print '</table>';
432print '</form>';
433print '<br><br>';
434
435print '<div class="div-table-responsive-no-min">';
436print '<table class="noborder centpercent">';
437print '<tr class="liste_titre" height="24">';
438print '<td class="center">'.$langs->trans("Year").'</td>';
439print '<td class="right">'.$langs->trans("NumberOfBills").'</td>';
440print '<td class="right">%</td>';
441print '<td class="right">'.$langs->trans("AmountTotal").'</td>';
442print '<td class="right">%</td>';
443print '<td class="right">'.$langs->trans("AmountAverage").'</td>';
444print '<td class="right">%</td>';
445print '</tr>';
446
447$oldyear = 0;
448foreach ($data as $val) {
449 $year = (int) $val['year'];
450 while ($year && $oldyear > $year + 1) { // If we have empty year
451 $oldyear--;
452
453 print '<tr class="oddeven" height="24">';
454 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>';
455 print '<td class="right">0</td>';
456 print '<td class="right"></td>';
457 print '<td class="right amount">0</td>';
458 print '<td class="right"></td>';
459 print '<td class="right amount">0</td>';
460 print '<td class="right"></td>';
461 print '</tr>';
462 }
463
464 if ($mode == 'supplier') {
465 $greennb = (empty($val['nb_diff']) || $val['nb_diff'] <= 0);
466 $greentotal = (empty($val['total_diff']) || $val['total_diff'] <= 0);
467 $greenavg = (empty($val['avg_diff']) || $val['avg_diff'] <= 0);
468 } else {
469 $greennb = (empty($val['nb_diff']) || $val['nb_diff'] >= 0);
470 $greentotal = (empty($val['total_diff']) || $val['total_diff'] >= 0);
471 $greenavg = (empty($val['avg_diff']) || $val['avg_diff'] >= 0);
472 }
473
474 print '<tr class="oddeven" height="24">';
475 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>';
476 print '<td class="right">'.$val['nb'].'</td>';
477 print '<td class="right opacitylow" style="'.($greennb ? 'color: green;' : 'color: red;').'">'.(!empty($val['nb_diff']) && $val['nb_diff'] < 0 ? '' : '+').round(!empty($val['nb_diff']) ? $val['nb_diff'] : 0).'%</td>';
478 print '<td class="right"><span class="amount">'.price(price2num($val['total'], 'MT'), 1).'</span></td>';
479 print '<td class="right opacitylow" style="'.($greentotal ? 'color: green;' : 'color: red;').'">'.(!empty($val['total_diff']) && $val['total_diff'] < 0 ? '' : '+').round(!empty($val['total_diff']) ? $val['total_diff'] : 0).'%</td>';
480 print '<td class="right"><span class="amount">'.price(price2num($val['avg'], 'MT'), 1).'</span></td>';
481 print '<td class="right opacitylow" style="'.($greenavg ? 'color: green;' : 'color: red;').'">'.(!empty($val['avg_diff']) && $val['avg_diff'] < 0 ? '' : '+').round(!empty($val['avg_diff']) ? $val['avg_diff'] : 0).'%</td>';
482 print '</tr>';
483 $oldyear = $year;
484}
485
486print '</table>';
487print '</div>';
488
489print '</div><div class="fichetwothirdright">';
490
491
492// Show graphs
493print '<table class="border centpercent"><tr class="pair nohover"><td align="center">';
494if ($mesg) {
495 print $mesg;
496} else {
497 print $px1->show();
498 print "<br>\n";
499 print $px2->show();
500 print "<br>\n";
501 print $px3->show();
502}
503print '</td></tr></table>';
504
505
506print '</div></div>';
507print '<div class="clearboth"></div>';
508
509
510print dol_get_fiche_end();
511
512// End of page
513llxFooter();
514$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
Class to build graphs.
static getDefaultGraphSizeForStats($direction, $defaultsize='')
getDefaultGraphSizeForStats
Class to manage stats for invoices (customer and supplier)
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 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)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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)
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.