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