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