Merge pull request #12476 from ptibogxiv/patch-280

NEW add total of value in product stat
This commit is contained in:
Laurent Destailleur 2020-01-15 14:11:01 +01:00 committed by GitHub
commit 373420edc0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 2 deletions

View File

@ -1127,7 +1127,20 @@ class DolGraph
$this->stringtoshow .= '</script>'."\n";
}
/**
* Output HTML string to total value
*
* @return string HTML string to total value
*/
public function total()
{
$value = 0;
foreach($this->data as $valarray) // Loop on each x
{
$value += $valarray[1];
}
return $value;
}
/**
* Output HTML string to show graph

View File

@ -4,6 +4,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2019 Thibault FOUCART <support@ptibogxiv.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -351,6 +352,7 @@ if ($result || empty($id))
$url = DOL_URL_ROOT.'/viewimage.php?modulepart='.$graphfiles[$key]['modulepart'].'&entity='.$object->entity.'&file='.urlencode($graphfiles[$key]['file']);
$px->draw($dir."/".$graphfiles[$key]['file'], $url);
$graphfiles[$key]['total'] = $px->total();
$graphfiles[$key]['output'] = $px->show();
}
else
@ -405,7 +407,7 @@ if ($result || empty($id))
// Label
print '<tr class="liste_titre"><td>';
print $graphfiles[$key]['label'];
print '</td>';
print ' ('.$graphfiles[$key]['total'].')</td>';
print '<td align="right">'.$linktoregenerate.'</td>';
print '</tr>';
// Image