dolibarr 19.0.3
card.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (c) 2004-2019 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
5 * Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
6 * Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
7 * Copyright (C) 2019 Thibault FOUCART <support@ptibogxiv.net>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
29// Load Dolibarr environment
30require '../../main.inc.php';
31require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
32require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
33require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
34require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
35require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
36require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
37
38$WIDTH = DolGraph::getDefaultGraphSizeForStats('width', 380);
39$HEIGHT = DolGraph::getDefaultGraphSizeForStats('height', 160);
40
41// Load translation files required by the page
42$langs->loadLangs(array('companies', 'products', 'stocks', 'bills', 'other'));
43
44$id = GETPOST('id', 'int'); // For this page, id can also be 'all'
45$ref = GETPOST('ref', 'alpha');
46$mode = (GETPOST('mode', 'alpha') ? GETPOST('mode', 'alpha') : 'byunit');
47$search_year = GETPOST('search_year', 'int');
48$search_categ = GETPOST('search_categ', 'int');
49$notab = GETPOST('notab', 'int');
50$type = GETPOST('type', 'alpha');
51
52$error = 0;
53$mesg = '';
54$graphfiles = array();
55
56$socid = GETPOST('socid', 'int');
57if (!empty($user->socid)) {
58 $socid = $user->socid;
59}
60if ($socid < 0) {
61 $socid = 0;
62}
63
64// Security check
65$fieldvalue = ($id > 0 ? $id : $ref);
66$fieldtype = (!empty($ref) ? 'ref' : 'rowid');
67
68// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
69$hookmanager->initHooks(array('productstatscard', 'globalcard'));
70
71$tmp = dol_getdate(dol_now());
72$currentyear = $tmp['year'];
73if (empty($search_year)) {
74 $search_year = $currentyear;
75}
76$moreforfilter = "";
77
78$object = new Product($db);
79if ($id > 0 || !empty($ref)) {
80 $result = $object->fetch($id, $ref);
81}
82
83$result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype);
84
85
86/*
87 * Actions
88 */
89
90// None
91
92
93/*
94 * View
95 */
96
97$form = new Form($db);
98$htmlother = new FormOther($db);
99
100if (!($id > 0) && empty($ref) || $notab) {
101 $notab = 1;
102
103 llxHeader("", $langs->trans("ProductStatistics"));
104
105 $type = GETPOST('type', 'int');
106
107 $helpurl = '';
108 if ($type == '0') {
109 $helpurl = 'EN:Module_Products|FR:Module_Produits|ES:M&oacute;dulo_Productos';
110 //$title=$langs->trans("StatisticsOfProducts");
111 $title = $langs->trans("Statistics");
112 } elseif ($type == '1') {
113 $helpurl = 'EN:Module_Services_En|FR:Module_Services|ES:M&oacute;dulo_Servicios';
114 //$title=$langs->trans("StatisticsOfServices");
115 $title = $langs->trans("Statistics");
116 } else {
117 $helpurl = 'EN:Module_Services_En|FR:Module_Services|ES:M&oacute;dulo_Servicios';
118 //$title=$langs->trans("StatisticsOfProductsOrServices");
119 $title = $langs->trans("Statistics");
120 }
121
122 $picto = 'product';
123 if ($type == 1) {
124 $picto = 'service';
125 }
126
127 print load_fiche_titre($title, $mesg, $picto);
128} else {
129 $result = $object->fetch($id, $ref);
130
131 $title = $langs->trans('ProductServiceCard');
132 $helpurl = '';
133 $shortlabel = dol_trunc($object->label, 16);
134 if (GETPOST("type") == '0' || ($object->type == Product::TYPE_PRODUCT)) {
135 $title = $langs->trans('Product')." ".$shortlabel." - ".$langs->trans('Statistics');
136 $helpurl = 'EN:Module_Products|FR:Module_Produits|ES:M&oacute;dulo_Productos';
137 }
138 if (GETPOST("type") == '1' || ($object->type == Product::TYPE_SERVICE)) {
139 $title = $langs->trans('Service')." ".$shortlabel." - ".$langs->trans('Statistics');
140 $helpurl = 'EN:Module_Services_En|FR:Module_Services|ES:M&oacute;dulo_Servicios';
141 }
142
143 llxHeader('', $title, $helpurl);
144}
145
146
147if ($result && ($id > 0 || !empty($ref)) && empty($notab)) {
148 $head = product_prepare_head($object);
149 $titre = $langs->trans("CardProduct".$object->type);
150 $picto = ($object->type == Product::TYPE_SERVICE ? 'service' : 'product');
151
152 print dol_get_fiche_head($head, 'stats', $titre, -1, $picto);
153
154 $linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php?restore_lastsearch_values=1&type='.$object->type.'">'.$langs->trans("BackToList").'</a>';
155
156 dol_banner_tab($object, 'ref', $linkback, ($user->socid ? 0 : 1), 'ref', '', '', '', 0, '', '', 1);
157
158 print dol_get_fiche_end();
159}
160if ((!($id > 0) && empty($ref)) || $notab) {
161 $h = 0;
162 $head = array();
163
164 $head[$h][0] = DOL_URL_ROOT.'/product/stats/card.php'.($type != '' ? '?type='.((int) $type) : '');
165 $head[$h][1] = $langs->trans("Chart");
166 $head[$h][2] = 'chart';
167 $h++;
168
169 $title = $langs->trans("ListProductServiceByPopularity");
170 if ((string) $type == '0') {
171 $title = $langs->trans("ListProductByPopularity");
172 }
173 if ((string) $type == '1') {
174 $title = $langs->trans("ListServiceByPopularity");
175 }
176
177
178 $head[$h][0] = DOL_URL_ROOT.'/product/popuprop.php'.($type != '' ? '?type='.((int) $type) : '');
179 $head[$h][1] = $langs->trans("ProductsServicesPerPopularity");
180 if ((string) $type == '0') {
181 $head[$h][1] = $langs->trans("ProductsPerPopularity");
182 }
183 if ((string) $type == '1') {
184 $head[$h][1] = $langs->trans("ServicesPerPopularity");
185 }
186 $head[$h][2] = 'popularity';
187 $h++;
188
189 print dol_get_fiche_head($head, 'chart', '', -1);
190}
191
192
193if ($result || !($id > 0)) {
194 print '<form name="stats" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
195 print '<input type="hidden" name="token" value="'.newToken().'">';
196 if (empty($id) || $notab) {
197 print '<input type="hidden" name="notab" value="1">';
198 }
199
200 print '<table class="noborder centpercent">';
201 print '<tr class="liste_titre"><td class="liste_titre">'.$langs->trans("Filter").'</td><td></td></tr>';
202
203 if (!($id > 0) || $notab) {
204 // Type
205 print '<tr class="nooddeven"><td class="titlefield">'.$langs->trans("Type").'</td><td>';
206 $array = array('-1'=>'&nbsp;', '0'=>$langs->trans('Product'), '1'=>$langs->trans('Service'));
207 print $form->selectarray('type', $array, $type, 0, 0, 0, '', 0, 0, 0, '', 'minwidth100');
208 print '</td></tr>';
209
210 // Product
211 print '<tr class="nooddeven"><td class="titlefield">'.$langs->trans("ProductOrService").'</td><td>';
212 print img_picto('', 'product', 'class="pictofixedwidth"');
213 print $form->select_produits($id, 'id', '', 0, 0, 1, 2, '', ($conf->dol_optimize_smallscreen ? 1 : 0), array(), 0, '1', 0, 'widthcentpercentminusx maxwidth400');
214 print '</td></tr>';
215
216 // Tag
217 if (isModEnabled('categorie')) {
218 print '<tr class="nooddeven"><td class="titlefield">'.$langs->trans("Categories").'</td><td>';
219 $moreforfilter .= img_picto($langs->trans("Categories"), 'category', 'class="pictofixedwidth"');
220 $moreforfilter .= $htmlother->select_categories(Categorie::TYPE_PRODUCT, $search_categ, 'search_categ', 1, 1, 'widthcentpercentminusx maxwidth400');
221 print $moreforfilter;
222 print '</td></tr>';
223 }
224 } else {
225 print '<input type="hidden" name="id" value="'.$id.'">';
226 }
227
228 // Year
229 print '<tr class="nooddeven"><td class="titlefield">'.$langs->trans("Year").'</td><td>';
230 $arrayyears = array();
231 for ($year = $currentyear - 25; $year < $currentyear; $year++) {
232 $arrayyears[$year] = $year;
233 }
234 if (!in_array($year, $arrayyears)) {
235 $arrayyears[$year] = $year;
236 }
237 if (!in_array($currentyear, $arrayyears)) {
238 $arrayyears[$currentyear] = $currentyear;
239 }
240 arsort($arrayyears);
241 print $form->selectarray('search_year', $arrayyears, $search_year, 1, 0, 0, '', 0, 0, 0, '', 'width75');
242 print '</td></tr>';
243
244 // thirdparty
245 print '<tr class="nooddeven"><td class="titlefield">'.$langs->trans("ThirdParty").'</td><td>';
246 print img_picto('', 'company', 'class="pictofixedwidth"');
247 print $form->select_company($socid, 'socid', '', 1, 0, 0, array(), 0, 'widthcentpercentminusx maxwidth400');
248 print '</td></tr>';
249
250 print '</table>';
251 print '<div class="center"><input type="submit" name="submit" class="button small" value="'.$langs->trans("Refresh").'"></div>';
252 print '</form><br>';
253
254 print '<br>';
255
256
257 $param = '';
258 $param .= (GETPOSTISSET('id') ? '&id='.GETPOST('id', 'int') : '&id='.$object->id).(($type != '' && $type != '-1') ? '&type='.((int) $type) : '').'&search_year='.((int) $search_year).($notab ? '&notab='.$notab : '');
259 if ($socid > 0) {
260 $param .= '&socid='.((int) $socid);
261 }
262
263 // Choice of stats mode (byunit or bynumber)
264
265 if (!empty($conf->dol_use_jmobile)) {
266 print "\n".'<div class="fichecenter"><div class="nowrap">'."\n";
267 }
268
269 if ($mode != 'byunit') {
270 print '<a class="a-mesure-disabled marginleftonly marginrightonly reposition" href="'.$_SERVER["PHP_SELF"].'?mode=byunit'.$param.'">';
271 } else {
272 print '<span class="a-mesure marginleftonly marginrightonly">';
273 }
274 if ($type == '0') {
275 print $langs->trans("StatsByNumberOfUnitsProducts");
276 } elseif ($type == '1') {
277 print $langs->trans("StatsByNumberOfUnitsServices");
278 } else {
279 print $langs->trans("StatsByNumberOfUnits");
280 }
281 if ($mode != 'byunit') {
282 print '</a>';
283 } else {
284 print '</span>';
285 }
286
287 if (!empty($conf->dol_use_jmobile)) {
288 print '</div>'."\n".'<div class="nowrap">'."\n";
289 }
290
291 if ($mode != 'bynumber') {
292 print '<a class="a-mesure-disabled marginleftonly marginrightonly reposition" href="'.$_SERVER["PHP_SELF"].'?mode=bynumber'.$param.'">';
293 } else {
294 print '<span class="a-mesure marginleftonly marginrightonly">';
295 }
296 print $langs->trans("StatsByNumberOfEntities");
297 if ($mode != 'bynumber') {
298 print '</a>';
299 } else {
300 print '</span>';
301 }
302
303 if (!empty($conf->dol_use_jmobile)) {
304 print '</div>'."\n".'<div class="nowrap">'."\n";
305 }
306
307 if ($mode != 'byamount') {
308 print '<a class="a-mesure-disabled marginleftonly marginrightonly reposition" href="'.$_SERVER["PHP_SELF"].'?mode=byamount'.$param.'">';
309 } else {
310 print '<span class="a-mesure marginleftonly marginrightonly">';
311 }
312 if ($type == '0') {
313 print $langs->trans("StatsByAmountProducts");
314 } elseif ($type == '1') {
315 print $langs->trans("StatsByAmountServices");
316 } else {
317 print $langs->trans("StatsByAmount");
318 }
319 if ($mode != 'byamount') {
320 print '</a>';
321 } else {
322 print '</span>';
323 }
324
325 // End of choices
326 if (!empty($conf->dol_use_jmobile)) {
327 print '</div></div>';
328 } else {
329 print '<br>';
330 }
331 print '<br>';
332
333 // Generation of graphs
334 $dir = (!empty($conf->product->multidir_temp[$conf->entity]) ? $conf->product->multidir_temp[$conf->entity] : $conf->service->multidir_temp[$conf->entity]);
335 if ($object->id > 0) { // We are on statistics for a dedicated product
336 if (!file_exists($dir.'/'.$object->id)) {
337 if (dol_mkdir($dir.'/'.$object->id) < 0) {
338 $mesg = $langs->trans("ErrorCanNotCreateDir", $dir);
339 $error++;
340 }
341 }
342 }
343
344 $arrayforlabel = array('byunit' => 'NumberOfUnits', 'bynumber' => 'NumberOf', 'byamount' => 'AmountIn');
345
346 if (isModEnabled('propal')) {
347 $graphfiles['propal'] = array('modulepart'=>'productstats_proposals',
348 'file' => $object->id.'/propal12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.($search_year > 0 ? '_year'.$search_year : '').'.png',
349 'label' => $langs->transnoentitiesnoconv($arrayforlabel[$mode], $langs->transnoentitiesnoconv("Proposals")));
350 }
351
352 if (isModEnabled('supplier_proposal')) {
353 $langs->load("supplier_proposal");
354 $graphfiles['proposalssuppliers'] = array('modulepart'=>'productstats_proposalssuppliers',
355 'file' => $object->id.'/proposalssuppliers12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.($search_year > 0 ? '_year'.$search_year : '').'.png',
356 'label' => $langs->transnoentitiesnoconv($arrayforlabel[$mode], $langs->transnoentitiesnoconv("SupplierProposals")));
357 }
358
359 if (isModEnabled('order')) {
360 $graphfiles['orders'] = array('modulepart'=>'productstats_orders',
361 'file' => $object->id.'/orders12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.($search_year > 0 ? '_year'.$search_year : '').'.png',
362 'label' => $langs->transnoentitiesnoconv($arrayforlabel[$mode], $langs->transnoentitiesnoconv("Orders")));
363 }
364
365 if (isModEnabled('supplier_order')) {
366 $graphfiles['orderssuppliers'] = array('modulepart'=>'productstats_orderssuppliers',
367 'file' => $object->id.'/orderssuppliers12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.($search_year > 0 ? '_year'.$search_year : '').'.png',
368 'label' => $langs->transnoentitiesnoconv($arrayforlabel[$mode], $langs->transnoentitiesnoconv("SuppliersOrders")));
369 }
370
371 if (isModEnabled('facture')) {
372 $graphfiles['invoices'] = array('modulepart'=>'productstats_invoices',
373 'file' => $object->id.'/invoices12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.($search_year > 0 ? '_year'.$search_year : '').'.png',
374 'label' => $langs->transnoentitiesnoconv($arrayforlabel[$mode], $langs->transnoentitiesnoconv("Invoices")));
375 }
376
377 if (isModEnabled('supplier_invoice')) {
378 $graphfiles['invoicessuppliers'] = array('modulepart'=>'productstats_invoicessuppliers',
379 'file' => $object->id.'/invoicessuppliers12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.($search_year > 0 ? '_year'.$search_year : '').'.png',
380 'label' => $langs->transnoentitiesnoconv($arrayforlabel[$mode], $langs->transnoentitiesnoconv("SupplierInvoices")));
381 }
382
383 if (isModEnabled('contrat')) {
384 $graphfiles['contracts'] = array('modulepart'=>'productstats_contracts',
385 'file' => $object->id.'/contracts12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.($search_year > 0 ? '_year'.$search_year : '').'.png',
386 'label' => $langs->transnoentitiesnoconv($arrayforlabel[$mode], $langs->transnoentitiesnoconv("Contracts")));
387 }
388
389 if (isModEnabled('mrp') && $mode != 'byamount') {
390 $graphfiles['mrp'] = array('modulepart'=>'productstats_mrp',
391 'file' => $object->id.'/mos12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.($search_year > 0 ? '_year'.$search_year : '').'.png',
392 'label' => $langs->transnoentitiesnoconv($arrayforlabel[$mode]."Mos"));
393 }
394
395 $px = new DolGraph();
396
397 if (!$error && count($graphfiles) > 0) {
398 $mesg = $px->isGraphKo();
399 if (!$mesg) {
400 foreach ($graphfiles as $key => $val) {
401 if (!$graphfiles[$key]['file']) {
402 continue;
403 }
404
405 $graph_data = array();
406
407 if (dol_is_file($dir.'/'.$graphfiles[$key]['file'])) {
408 // TODO Load cachefile $graphfiles[$key]['file']
409 } else {
410 $morefilters = '';
411 if ($search_categ > 0) {
412 $categ = new Categorie($db);
413 $categ->fetch($search_categ);
414 $listofprodids = $categ->getObjectsInCateg('product', 1);
415 $morefilters = ' AND d.fk_product IN ('.$db->sanitize((is_array($listofprodids) && count($listofprodids)) ? join(',', $listofprodids) : '0').')';
416 }
417 if ($search_categ == -2) {
418 $morefilters = ' AND NOT EXISTS (SELECT cp.fk_product FROM '.MAIN_DB_PREFIX.'categorie_product as cp WHERE d.fk_product = cp.fk_product)';
419 }
420
421 if ($key == 'propal') {
422 $graph_data = $object->get_nb_propal($socid, $mode, ((string) $type != '' ? $type : -1), $search_year, $morefilters);
423 }
424 if ($key == 'orders') {
425 $graph_data = $object->get_nb_order($socid, $mode, ((string) $type != '' ? $type : -1), $search_year, $morefilters);
426 }
427 if ($key == 'invoices') {
428 $graph_data = $object->get_nb_vente($socid, $mode, ((string) $type != '' ? $type : -1), $search_year, $morefilters);
429 }
430 if ($key == 'proposalssuppliers') {
431 $graph_data = $object->get_nb_propalsupplier($socid, $mode, ((string) $type != '' ? $type : -1), $search_year, $morefilters);
432 }
433 if ($key == 'invoicessuppliers') {
434 $graph_data = $object->get_nb_achat($socid, $mode, ((string) $type != '' ? $type : -1), $search_year, $morefilters);
435 }
436 if ($key == 'orderssuppliers') {
437 $graph_data = $object->get_nb_ordersupplier($socid, $mode, ((string) $type != '' ? $type : -1), $search_year, $morefilters);
438 }
439 if ($key == 'contracts') {
440 $graph_data = $object->get_nb_contract($socid, $mode, ((string) $type != '' ? $type : -1), $search_year, $morefilters);
441 }
442 if ($key == 'mrp') {
443 $graph_data = $object->get_nb_mos($socid, $mode, ((string) $type != '' ? $type : -1), $search_year, $morefilters);
444 }
445
446 // TODO Save cachefile $graphfiles[$key]['file']
447 }
448
449 if (is_array($graph_data)) {
450 $px->SetData($graph_data);
451 $px->SetYLabel($graphfiles[$key]['label']);
452 $px->SetMaxValue($px->GetCeilMaxValue() < 0 ? 0 : $px->GetCeilMaxValue());
453 $px->SetMinValue($px->GetFloorMinValue() > 0 ? 0 : $px->GetFloorMinValue());
454 $px->setShowLegend(0);
455 $px->SetWidth($WIDTH);
456 $px->SetHeight($HEIGHT);
457 $px->SetHorizTickIncrement(1);
458 $px->SetShading(3);
459 //print 'x '.$key.' '.$graphfiles[$key]['file'];
460
461 $url = DOL_URL_ROOT.'/viewimage.php?modulepart='.$graphfiles[$key]['modulepart'].'&entity='.((int) $object->entity).'&file='.urlencode($graphfiles[$key]['file']).($notab ? '&notab='.$notab : '');
462 $px->draw($dir."/".$graphfiles[$key]['file'], $url);
463
464 $graphfiles[$key]['total'] = $px->total();
465 $graphfiles[$key]['output'] = $px->show();
466 } else {
467 dol_print_error($db, 'Error for calculating graph on key='.$key.' - '.$object->error);
468 }
469 }
470
471 //setEventMessages($langs->trans("ChartGenerated"), null, 'mesgs');
472 }
473 }
474
475 // Show graphs
476 $i = 0;
477 if (count($graphfiles) > 0) {
478 foreach ($graphfiles as $key => $val) {
479 if (!$graphfiles[$key]['file']) {
480 continue;
481 }
482
483 if ($graphfiles == 'propal' && !$user->hasRight('propal', 'lire')) {
484 continue;
485 }
486 if ($graphfiles == 'order' && !$user->hasRight('commande', 'lire')) {
487 continue;
488 }
489 if ($graphfiles == 'invoices' && !$user->hasRight('facture', 'lire')) {
490 continue;
491 }
492 if ($graphfiles == 'proposals_suppliers' && !$user->hasRight('supplier_proposal', 'lire')) {
493 continue;
494 }
495 if ($graphfiles == 'invoices_suppliers' && !$user->hasRight('fournisseur', 'facture', 'lire')) {
496 continue;
497 }
498 if ($graphfiles == 'orders_suppliers' && !$user->hasRight('fournisseur', 'commande', 'lire')) {
499 continue;
500 }
501 if ($graphfiles == 'mrp' && !$user->hasRight('mrp', 'read')) {
502 continue;
503 }
504
505
506 if ($i % 2 == 0) {
507 print "\n".'<div class="fichecenter"><div class="fichehalfleft">'."\n";
508 } else {
509 print "\n".'<div class="fichehalfright">'."\n";
510 }
511
512 // Date generation
513 if ($graphfiles[$key]['output'] && !$px->isGraphKo()) {
514 if (file_exists($dir."/".$graphfiles[$key]['file']) && filemtime($dir."/".$graphfiles[$key]['file'])) {
515 $dategenerated = $langs->trans("GeneratedOn", dol_print_date(filemtime($dir."/".$graphfiles[$key]['file']), "dayhour"));
516 } else {
517 $dategenerated = $langs->trans("GeneratedOn", dol_print_date(dol_now(), "dayhour"));
518 }
519 } else {
520 $dategenerated = ($mesg ? '<span class="error">'.$mesg.'</span>' : $langs->trans("ChartNotGenerated"));
521 }
522 $linktoregenerate = '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?'.(GETPOSTISSET('id') ? 'id='.GETPOST('id', 'int') : 'id='.$object->id).(((string) $type != '' && $type != '-1') ? '&type='.((int) $type) : '').'&action=recalcul&mode='.urlencode($mode).'&search_year='.((int) $search_year).($search_categ > 0 ? '&search_categ='.((int) $search_categ) : '').'">';
523 $linktoregenerate .= img_picto($langs->trans("ReCalculate").' ('.$dategenerated.')', 'refresh');
524 $linktoregenerate .= '</a>';
525
526
527 // Show graph
528 print '<div class="div-table-responsive-no-min">';
529 print '<table class="noborder centpercent">';
530 // Label
531 print '<tr class="liste_titre"><td>';
532 print $graphfiles[$key]['label'];
533 print ' <span class="opacitymedium">('.$graphfiles[$key]['total'].')</span></td>';
534 print '<td align="right">'.$linktoregenerate.'</td>';
535 print '</tr>';
536 // Image
537 print '<tr><td colspan="2" class="nohover" align="center">';
538 print $graphfiles[$key]['output'];
539 print '</td></tr>';
540 print '</table>';
541 print '</div>';
542
543 if ($i % 2 == 0) {
544 print "\n".'</div>'."\n";
545 } else {
546 print "\n".'</div></div>';
547 print '<div class="clear"><div class="fichecenter"><br></div></div>'."\n";
548 }
549
550 $i++;
551 }
552 }
553 // div not closed
554 if ($i % 2 == 1) {
555 print "\n".'<div class="fichehalfright">'."\n";
556 print "\n".'</div></div>';
557 print '<div class="clear"><div class="fichecenter"><br></div></div>'."\n";
558 }
559}
560
561if (!($id > 0)) {
562 print dol_get_fiche_end();
563}
564
565// End of page
566llxFooter();
567$db->close();
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Definition wrapper.php:55
llxFooter()
Empty footer.
Definition wrapper.php:69
Class to manage categories.
Class to build graphs.
static getDefaultGraphSizeForStats($direction, $defaultsize='')
getDefaultGraphSizeForStats
Class to manage generation of HTML components Only common components must be here.
Classe permettant la generation de composants html autre Only common components are here.
Class to manage products or services.
const TYPE_PRODUCT
Regular product.
const TYPE_SERVICE
Service.
dol_is_file($pathoffile)
Return if path is a file.
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
dol_getdate($timestamp, $fast=false, $forcetimezone='')
Return an array with locale date info.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
product_prepare_head($object)
Prepare array with list of tabs.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.