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